/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author YDZ
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface BasMesRoute extends BasicModel<BasMesRoute> {
  code?: string; // 工艺编码
  name?: string; // 工艺名称
  workShopCode?: string; // 归属车间
  invCode?: string; // 产品编码
  basMesRouteOperList?: any[]; // 子表列表
}

export const basMesRouteList = (params?: BasMesRoute | any) =>
  defHttp.get<BasMesRoute>({ url: adminPath + '/bas/mes/route/basMesRoute/list', params });

export const basMesRouteListData = (params?: BasMesRoute | any) =>
  defHttp.post<Page<BasMesRoute>>({
    url: adminPath + '/bas/mes/route/basMesRoute/listData',
    params,
  });

export const basMesRouteForm = (params?: BasMesRoute | any) =>
  defHttp.get<BasMesRoute>({ url: adminPath + '/bas/mes/route/basMesRoute/form', params });

export const basMesRouteSave = (params?: any, data?: BasMesRoute | any) =>
  defHttp.postJson<BasMesRoute>({
    url: adminPath + '/bas/mes/route/basMesRoute/save',
    params,
    data,
  });

export const basMesRouteImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/bas/mes/route/basMesRoute/importData',
      onUploadProgress,
    },
    params,
  );

export const basMesRouteDelete = (params?: BasMesRoute | any) =>
  defHttp.get<BasMesRoute>({ url: adminPath + '/bas/mes/route/basMesRoute/delete', params });
